#!/bin/bash
cd /tmp/;
curl http://10.37.128.50:8080/tb.sql -o tb.sql
	export ORACLE_BASE=/oracle/app
	export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
	export ORACLE_SID=rzles
	export ORACLE_TERM=xterm
	export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
	export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
	export LANG=en_US
	export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
	source /home/oracle/.bash_profile
	usage=`sqlplus / as sysdba  </tmp/tb.sql | grep $1 |awk '{print $4}'`
	host=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 192.*|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
	tbsName=$1
	echo $usage
	echo $host
	echo $tbsName

curl -s -X POST -H 'Content-Type:application/json' -d '
{ }' http://10.37.133.20:5001/checkTbsUsage?host=$host\&tbsName=$tbsName\&usage=$usage | python -m json.tool
